package main

import (
	"cashback/api"
	"cashback/cashback/db"

	"github.com/gin-gonic/gin"
)

func main() {
	r := gin.Default()

	// 初始化数据库
	dbConfig := db.Config{
		Host:     "127.0.0.1",
		Port:     "8088",
		User:     "cashback",
		Password: "cb123456",
		DBName:   "cashback",
	}
	if err := db.InitDB(dbConfig); err != nil {
		panic("数据库连接失败: " + err.Error())
	}

	// 设置路由
	api.SetupRoutes(r)

	r.Run(":8080")
}
